package com.yogi.webframework.web;

import java.io.Serializable;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yogi.webframework.dao.GenericDao;
import com.yogi.webframework.dao.ShopDao;
import com.yogi.webframework.dto.ShopDto;
import com.yogi.webframework.model.Shop;
import com.yogi.webframework.service.GenericService;

@Controller
@RequestMapping("/shop")
@Transactional( propagation = Propagation.REQUIRES_NEW, readOnly=true)
public class ShopController extends AbstractCRUDControllerBean<Shop, ShopDto, Serializable>{

//	@Autowired ShopService shopService;
	@Autowired ShopDao shopDao;
	
//	@RequestMapping("/delete.html")
//	public String doDelete(){
//		Shop shop = shopService.findById(4);
//			
//		shopService.delete(shop);
//		return "index";
//	}
//	
//	
	public ShopController(){
		super.setTitle("Shop Management");
	}
	
	@Override
	public GenericDao<Shop, Serializable> getDao() {		
		return this.shopDao;
	}
	
	@Override
	public String getViewForm() {
		return "shop_form";
	}

	@Override
	public String getViewList() {
		return "shop_list";
	}
	
	@Override
	public String getViewListRedirect() {
		return "redirect:/shop/list.html";
	}

	@Override
	public GenericService<ShopDto, Serializable> getService() {
		return null;
	}
	
}
